// CodeEditorPane.cpp : implementation file
//

#include "stdafx.h"
#include "ogleditor.h"
#include "CodeEditor.h"


// CodeEditorPane

IMPLEMENT_DYNAMIC(CodeEditorPane, CDockablePane)

CodeEditorPane::CodeEditorPane()
{

}

CodeEditorPane::~CodeEditorPane()
{
}


BEGIN_MESSAGE_MAP(CodeEditorPane, CDockablePane)
	ON_WM_CREATE()
	ON_WM_SIZE()
END_MESSAGE_MAP()



// CodeEditorPane message handlers

int CodeEditorPane::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CDockablePane::OnCreate(lpCreateStruct) == -1)
		return -1;

	CRect rectDummy;
	rectDummy.SetRectEmpty();

	// Create tabs window:
	if (!m_wndTabs.Create(CMFCTabCtrl::STYLE_3D, rectDummy, this, 1))
	{
		TRACE(_T("Failed to create tabs\n"));
		return -1;      // fail to create
	}
	m_wndTabs.SetFlatFrame();

	m_wndTabs.EnableTabSwap(FALSE);

	m_editorTab.Create(&m_wndTabs, SourceEditorDlgBar::IDD, CBRS_ALIGN_TOP | CBRS_ALIGN_LEFT, SourceEditorDlgBar::IDD);
	m_wndTabs.InsertTab(&m_editorTab, _T(""), 0);
	m_wndTabs.SetTabLabel(0, _T("Source"));

	//set active tab
	m_wndTabs.SetActiveTab(0);
	return 0;
}

void CodeEditorPane::OnSize(UINT nType, int cx, int cy) 
{
	CDockablePane::OnSize(nType, cx, cy);

	m_wndTabs.SetWindowPos (nullptr, -1, -1, cx, cy, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER);
}

